﻿using FluentValidation;
using GiveAQuiz.Web.Helpers;
using GiveAQuiz.Web.Models;

namespace GiveAQuiz.Web.Validation
{
  /// <summary>
  /// Validate the LogOnViewModel
  /// </summary>
  public class LogOnValidator : AbstractValidator<LogOnViewModel>
  {
    /// <summary>
    /// Create a new instance of the LogOnValidator
    /// </summary>
    /// <param name="membershipSvc">The IMembershipService interface
    /// used to perform Authentication.</param>
    public LogOnValidator()
    {
      // field-level validation
      RuleFor(lo => lo.UserName).NotBlank().WithMessage("Username is required");      
      RuleFor(lo => lo.Password).NotBlank().WithMessage("Password is required");      
    }
  }
}